package com.goldman.aplt.job;

import com.goldman.aplt.service.mq.MessageProducer;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.core.log.XxlJobLogger;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class MqMessageSendJob {

    @Autowired
    private MessageProducer messageProducer;

    @XxlJob(value = "mqMessageSendJob")
    public ReturnT<String> execute(String customParams) {
        try {
            XxlJobLogger.log("XXL-JOB, CfbPersonAcctCloseJob Start");
            messageProducer.autoSendMq();
            log.info("CfbPersonAcctCloseJob开始执行！！！");
            XxlJobLogger.log("XXL-JOB, CfbPersonAcctCloseJob End");
            return ReturnT.SUCCESS;
        } catch (Exception e) {
            log.error("CfbPersonAcctCloseJob err", e);
            XxlJobLogger.log("XXL-JOB, CfbPersonAcctCloseJob End");
            return ReturnT.FAIL;
        }
    }
}
